<?php

use yii\helpers\Inflector;
use yii\helpers\StringHelper;

/* @var $this yii\web\View */
/* @var $generator yii\gii\generators\crud\Generator */

/* @var $model \yii\db\ActiveRecord */
$model = new $generator->modelClass();
$safeAttributes = $model->safeAttributes();
if (empty($safeAttributes)) {
    $safeAttributes = $model->attributes();
}

echo "<?php\n";
?>

use yii\helpers\Html;
use yii\widgets\ActiveForm;

/* @var $this yii\web\View */
/* @var $model <?= ltrim($generator->modelClass, '\\') ?> */
/* @var $form yii\widgets\ActiveForm */
?>
<link rel="stylesheet" href="/static/css/form.css">
<div class="form">

    <?= "<?php " ?>$form = ActiveForm::begin([
            'options'=>['class' => '','style'=>'padding-top:20px;'],
            'fieldConfig' => [
                'labelOptions' => ['class' => 'layui-form-label'],
                'inputOptions' => ['class' => 'layui-input','style'=>'width:300px'],
            ]
        
    ]); ?>
    <fieldset class="layui-elem-field layui-field-title" >
        <legend> <?= "<?= " ?>$model->isNewRecord?'新增':'修改' <?= "?>" ?>资料</legend>
    </fieldset>
    <?= "<?= " ?> echo $form->errorSummary($model); <?= "?>" ?>
    <table class="table table-bordered table-hover ">	
<?php foreach ($generator->getColumnNames() as $attribute) {
    if (in_array($attribute, $safeAttributes)) {
        echo "
        <tr>
        	<td width=\"20%\" class=\"tableleft\">".'<?= $model->attributeLabels'."()['$attribute'] ?><span class=\"required\">*</span></td>
            <td><?= " . $generator->generateActiveField($attribute) . "->label(false) ?></td>
  	  	</tr>\n\n";
    }
} ?>
    </table>
    <div class="form-group">
        <?= "<?= " ?>Html::submitButton($model->isNewRecord ? '保存' : '提交修改', ['class' => 'layui-btn']) ?>
    </div>

    <?= "<?php " ?>ActiveForm::end(); ?>

</div>
